package com.example.springboot159.bean;


public class BaseResult extends Throwable {
    private String code;
    private String errMsg;
    private Object data;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
    @Override
    public String toString() {
        return "BaseResult{" +
                "code='" + code + '\'' +
                ", errMsg='" + errMsg + '\'' +
                ", data=" + data +
                '}';
    }
    public static BaseResult buildResult(String code,String errMsg,Object data){
        BaseResult baseResult = new BaseResult();
        baseResult.setData(data);
        baseResult.setErrMsg(errMsg);
        baseResult.setCode(code);
        return baseResult;
    }
}
